from typing import List


def hIndex(self, citations: List[int]) -> int:
    n = len(citations)
    l, r = -1, n + 1
    while l + 1 < r:
        mid = (l + r) // 2
        # 至少第mid个成果 被引用的数量 至少为mid次
        if citations[-mid] >= mid:
            l = mid
        else:
            r = mid
    return r - 1